package com.gnerv.battle.boot.project.guard.controller;

import com.gnerv.battle.boot.common.base.model.RestResult;
import com.gnerv.battle.boot.project.guard.business.MonitorDeployBusiness;
import com.gnerv.battle.boot.project.guard.business.MonitorNodeConfigBusiness;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * @author Gnerv LiGen
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping(value = "api/monitor/node")
public class MonitorDeployController {

    private final MonitorDeployBusiness monitorDeployBusiness;

    @PostMapping(value = "deploy")
    public RestResult<String> deployByUkId(@RequestParam(value = "nodeUkId") String nodeUkId) throws IOException {
        monitorDeployBusiness.deployByNodeUkId(nodeUkId);
        return RestResult.ok(nodeUkId);
    }


}
